<?php
header("Content-Type:text/html;charset=utf-8");
 error_reporting(E_ALL ^ E_NOTICE);
/*
 * Created on 2012-2-25
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 include("../../nncms_manager_inc.php");
//获取权限检查类
session_start();
//导入语言包
 if (isset($_SESSION["language_dir"])){
 	$language_dir=$_SESSION["language_dir"];
 }
include $nncms_config_path. "nn_cms_manager/languages/". $language_dir. "/language.php";
include $nncms_config_path. "nn_cms_manager/languages/". $language_dir. "/language_media.php";
include $nncms_config_path. "nn_cms_manager/controls/nncms_controls_public_function.php";
include_once($nncms_config_path.'nn_cms_manager/nncms_mlang.php');
 $method=$_GET["method"];
 $search=$_GET["search"];
 $asset_id=$_GET["asset_id"];
 $nns_more_select=$_GET["more_select"];

 $category_id=$_GET["category_id"];

  $currentpage=1;
  if (!empty($_GET["page"])) $currentpage=$_GET["page"];
  $listnum=8;
 include ($nncms_config_path. "nn_cms_config/nn_cms_global.php");
 $method_str=$language_media_mt;
 	if ($method=="vod"){
 		$method_param=0;
 	}else if ($method=="live"){
 		$method_param=1;
 	}
 	 include_once LOGIC_DIR. "asset/asset.class.php";
// 	  include_once LOGIC_DIR. "asset/asset_item.class.php";
// 	  	 $depot_array=nl_asset_item::get_asset_item_list_by_child($dc,$nns_org_type,$nns_org_id,$method_param);
 	$dc = nl_get_dc(array (
		'db_policy' => NL_DB_WRITE,
		'cache_policy' => NP_KV_CACHE_TYPE_MEMCACHE
			));
	$dc->open();
	
	$asset_info=nl_asset::get_asset_info($dc,$asset_id);
//	var_dump($asset_info);die;
	$base_name=$asset_info[0]['nns_name'];
	$base_id=$asset_info[0]['nns_id'];
	$data=$asset_info;




?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="../../css/allstyle.css" rel="stylesheet" type="text/css" />
<link href="../../css/rightframestyle.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../../css/dtree.css" type="text/css" />
<link href="../../css/selectbox.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="../../js/dtree.js"></script>
<script language="javascript" src="../../js/jquery-1.4.3.min.js"></script>
<script language="javascript" src="../../js/table.js.php"></script>
<script language="javascript" src="../../js/trim.js"></script>
<script language="javascript" src="../../js/category_count.js"></script>
<script language="javascript" src="../../js/cms_alert_select_box_style.js"></script>
<script language="javascript">
var virtual=0;
function set_video_id(id,type,name,star){
	window.parent.set_video_id(id,type,name,star);
	window.parent.close_select();
	refresh_video_box();
}

function set_more_video_id(){
	var data=$(".video_frame iframe")[0].contentWindow.get_more_select();
	window.parent.set_video_id(data.ids,data.types);
//	window.parent.close_select();
	refresh_video_box();
}

var now_select_id;
$(document).ready(function(){
	<!-- 2012-9-2 bo.chen@starcorcn.com  媒资包 资源库的点播分类影片数据统计-->
	category.count('assist',<?php echo '\''.$asset_id.'\''?>);

	$(".closebtn").click(function(){
		window.parent.close_select();
	});
	$(".category_editbox").width($(".content").width()-250);
	$(".service_frame iframe").width($(".content").width()-250);
	 $(window).resize(function(){
	$(".category_editbox").width($(".content").width()-250);
	$(".service_frame iframe").width($(".content").width()-250);
													});


	$(".selectbox").hide();
		$(".selectbox").css("left",($("body").width()-$(".selectbox").width())/2);
		$(".selectbox").css("top",10);

		
});




function checkhiddenInput(){
	var par=getAllCheckBoxSelect();
	if (par==""){
		alert("<?php echo cms_get_lang('lmgl_msg_noselect');?>");
	}else{
		$('#nns_id').attr('value',getAllCheckBoxSelect());
		checkForm('<?php echo cms_get_lang('titile');?>','<?php echo cms_get_lang('msg_ask_delete');?>',$('#delete_form'));
	}
}

function select_tree_item(item_id,item_name,parent_id,virtual){
	window.virtual=virtual;
	
	$(".category_editbox").find(".category_edit_id").html(item_id);
	$(".category_editbox").find(".category_edit_name").html(item_name);
		$(".video_frame").show();
		now_select_id=item_id;
		refresh_video_box();
}
function refresh_video_box(){
	<?php if ($nns_more_select==true){?>
			$(".video_frame iframe").attr("src","nncms_controls_asset_video_more_select_list.php?&virtual="+window.virtual+"&category_id="+now_select_id+"&asset_id=<?php echo $asset_id;?><?php echo $except_url;?>&search="+encodeURI($("#nns_video_search").val()));
	<?php }?>
}


function checkheight(){
		$(".video_frame iframe").height($(".video_frame iframe").contents().find(".content").height());
		$(".category_tree").height($(".category_editbox").height()-20);

	}


	function close_select(){
		$(".selectbox").hide();
	}



</script>
</head>

<body  style='width:760px;'>
<div class="content video_select_control" style="padding:0px; margin:0px;">
<div class="closebtn"><img src="../../images/topicon_08-topicon.png" /></div>
<div class="select_title"><b><?php echo cms_get_lang('media_select_box');?></b></div>

	<div style="background-color:#FFF;">

	    <div class="category_tree" style="padding:10px; margin:10px; overflow-y:auto;width:180px;background:#F5F5F5;min-height:410px;">
			<?php
			if ($data!=null){
				$assist_content=$data[0]["nns_category"];
			}else{
				$assist_content=null;
			}
			
			if ($category_id){
				$select_arr=array($category_id);
			}
			
			echo	pub_func_get_tree_by_html($assist_content,$base_name,$base_id,$select_arr);

	        ?>
	    </div>
	    <div class="category_editbox"  style="padding:10px; margin:0px;">
		     <div class="content_table">
	    	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	        <tbody>
	    			<tr>
			                <td width="120"><?php echo cms_get_lang('lmgl_nrlmid');?>:</td>
			                <td class="category_edit_id"></td>
			                <td width="120"><font class="font_red" style="color:#F00;font-size:16px; font-weight:bold;">*</font><?php echo cms_get_lang('lmgl_lmmc');?>:</td>
			                <td  class="category_edit_name"  width="200"></td>
			      	</tr>
			              <tr>
			                <td width="120"><?php echo cms_get_lang('search');?>:</td>
                			<td width="200"><input name="nns_video_search" id="nns_video_search" type="text"
                				value="" onchange="refresh_video_box();"
                				/></td>

			                <td><input type="button" value="<?php echo cms_get_lang('search');?>" onclick="search_video();"/></td>
			                <td><?php if ($nns_more_select==true){?>
			                		<input type="button" value="<?php echo cms_get_lang('confirm_search_xz');?>" onclick="set_more_video_id();"/>
			                	<?php }?>
			                </td>
			      		</tr>
			      </tbody>
			      </table>
			    </div>

	    		<div class="video_frame" style="height:370px; overflow-y:auto; width:100%">
	    			<iframe  scrolling="auto" frameborder="0" onload="checkheight();" style="width:100%;overflow-x:hidden;"></iframe>
	    		</div>

	    </div>
	    <div style="clear:both;"/>
    </div>
</div>
</body>
</html>